API Documentation
Public Member Functions | List of all members
nkGraphics::ShaderManager Class Referencefinal

Manages the sahders available in the component. More...

Inheritance diagram for nkGraphics::ShaderManager:

Public Member Functions

 ~ShaderManager ()
 
bool isBuiltInShader (Shader *toTest)
 
ShadercreateOrRetrieve (const nkMemory::StringView &name)
 
Shaderget (const nkMemory::StringView &name)
 
ShadergetByIndex (unsigned int index)
 
void rename (const nkMemory::StringView &oldName, const nkMemory::StringView &newName)
 
void erase (const nkMemory::StringView &name)
 

Detailed Description

Manages the sahders available in the component.

The manager is responsible for the allocated memory it returns. External code should never delete returned memory.

Constructor & Destructor Documentation

◆ ~ShaderManager()

nkGraphics::ShaderManager::~ShaderManager ( )

Destructor.

Member Function Documentation

◆ isBuiltInShader()

bool nkGraphics::ShaderManager::isBuiltInShader ( Shader toTest)

Checks whether a shader is built-in, aka offered by the component as a default solution.

Parameters
toTestThe shader to test.
Returns
If the shader is built-in (true) or not (false).

◆ createOrRetrieve()

Shader* nkGraphics::ShaderManager::createOrRetrieve ( const nkMemory::StringView name)

Creates if unavailable, or retrieve if available, a shader.

Parameters
nameThe name of the shader to retrieve.
Returns
Requested shader, possibly freshly created. The manager owns the memory alloated, external memory should not delete it. See eraseShader().

◆ get()

Shader* nkGraphics::ShaderManager::get ( const nkMemory::StringView name)

Retrieves an existing shader.

Parameters
nameThe name of the shader to retrieve.
Returns
The shader if available, nullptr else.

◆ getByIndex()

Shader* nkGraphics::ShaderManager::getByIndex ( unsigned int  index)

Retrieves a shader by index. Note that an index can point to different shaders as the memory of the manager is changed. Useful to loop over all available shaders in one go.

Parameters
indexThe index of the shader to retrieve.
Returns
The shader linked if available, nullptr else.

◆ rename()

void nkGraphics::ShaderManager::rename ( const nkMemory::StringView oldName,
const nkMemory::StringView newName 
)

Renames a shader, changing both its name and the way to find it in the manager.

Parameters
oldNameThe name of the shader to alter.
newNameThe new name to assign.

◆ erase()

void nkGraphics::ShaderManager::erase ( const nkMemory::StringView name)

Erases a shader and frees its memory.

Parameters
nameThe name of the shader to erase.

The documentation for this class was generated from the following file: